/*
 * Copyright (c) 2014 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

:host {
  flex: none;
  padding: 0 2px;
}

.toolbar-shadow {
  position: relative;
  white-space: nowrap;
  height: 26px;
  overflow: hidden;
  z-index: 12;
  display: flex;
  flex: none;
  align-items: center;
}

.toolbar-shadow.wrappable {
  flex-wrap: wrap;
  overflow: visible;
}

.toolbar-shadow.toolbar-grow-vertical {
  height: initial;
}

.toolbar-shadow.vertical {
  flex-direction: column;
  height: auto;
  align-items: flex-start;
}

.toolbar-item {
  position: relative;
  display: flex;
  background-color: transparent;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  height: 26px;
  border: none;
  white-space: pre;
}

.toolbar-item,
.toolbar-item .devtools-link {
  color: #5a5a5a;
}

select.toolbar-item:disabled {
  opacity: 0.5;
}

.toolbar-dropdown-arrow {
  background-color: #6d6d6d;
  pointer-events: none;
  flex: none;
}

select.toolbar-item:disabled + .toolbar-dropdown-arrow {
  opacity: 0.5;
}

/* Toolbar item */

.toolbar-button {
  white-space: nowrap;
  overflow: hidden;
  min-width: 28px;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
}

.toolbar-text {
  margin: 0 5px;
  flex: none;
  color: #5a5a5a;
}

.toolbar-text:empty {
  margin: 0;
}

.toolbar-has-dropdown {
  justify-content: space-between;
  padding: 0 3px 0 5px;
  border: 1px solid transparent;
}

.toolbar-has-dropdown .toolbar-text {
  margin: 0 4px 0 0;
  text-overflow: ellipsis;
  flex: auto;
  overflow: hidden;
  text-align: right;
}

.toolbar-button.dark-text .toolbar-dropdown-arrow {
  background-color: #333;
}

.toolbar-has-glyph .toolbar-text {
  margin-left: -4px;
}

.toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):not(.toolbar-button-secondary) {
  font-weight: bold;
}

.toolbar-render-as-links * {
  font-weight: initial;
  color: rgb(17, 85, 204);
  text-decoration: underline;
  cursor: pointer;
}

.toolbar-toggled-gray:not(.toolbar-render-as-links)
  .toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):hover {
  background-color: var(--toolbar-bg-color);
}

.toolbar-glyph {
  background-color: #5a5a5a;
  flex: none;
}

/* Button */

.toolbar-button:disabled {
  opacity: 0.5;
}

.toolbar-button.dark-text .toolbar-text {
  color: #333 !important;
}

:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-glyph {
  background-color: #333;
}

:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-text {
  color: #333;
}

.toolbar-button.toolbar-state-on .toolbar-glyph,
.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover:not(:active) {
  background-color: var(--accent-color);
}

.toolbar-button.toolbar-state-on .toolbar-text {
  color: var(--accent-color);
}

.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-glyph {
  background-color: white;
}

.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-text {
  color: white;
}

.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-glyph,
.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:active:hover {
  background-color: var(--accent-color);
}

.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-text {
  color: var(--accent-color);
}

.toolbar-toggled-gray .toolbar-button.toolbar-state-on {
  background-color: var(--toolbar-bg-color) !important;
}

.toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-glyph,
.toolbar-button.toolbar-state-off.toolbar-default-with-red-color .toolbar-glyph {
  background-color: rgb(216, 0, 0) !important;
}

:host-context(.-theme-with-dark-background)
  .toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color
  .toolbar-glyph,
:host-context(.-theme-with-dark-background)
  .toolbar-button.toolbar-state-off.toolbar-default-with-red-color
  .toolbar-glyph {
  background-color: hsl(0, 100%, 65%) !important;
}

/* Checkbox */

.toolbar-item.checkbox {
  padding: 0 5px 0 2px;
}

.toolbar-item.checkbox:hover {
  color: #333;
}

/* Select */

.toolbar-select-container {
  display: inline-flex;
  flex-shrink: 0;
  margin-right: 6px;
}

select.toolbar-item {
  min-width: 38px;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0 13px 0 5px;
  margin-right: -10px;
  position: relative;
  height: 22px;
  margin-top: 2px;
  margin-bottom: 2px;
}

select.toolbar-item[data-keyboard-focus='true']:focus {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

select.toolbar-item[data-keyboard-focus='true']:focus > * {
  background: white;
}

/* Input */

.toolbar-input {
  width: 120px;
  height: 19px;
  padding: 4px 3px 3px 3px;
  margin: 1px 3px;
  background-color: white;
  border: 1px solid transparent;
  min-width: 35px;
}

.toolbar-input:hover {
  box-shadow: var(--focus-ring-inactive-shadow);
}

.toolbar-input.focused,
.toolbar-input:not(.toolbar-input-empty) {
  box-shadow: var(--focus-ring-active-shadow);
}

.toolbar-input > input {
  border: none;
  flex-grow: 1;
}

.toolbar-input-clear-button {
  opacity: 0.7;
  flex-basis: 13px;
  flex-shrink: 0;
  height: 16px;
}

.toolbar-input-clear-button:hover {
  opacity: 0.99;
}

.toolbar-input-empty .toolbar-input-clear-button {
  display: none;
}

.toolbar-prompt-proxy {
  flex: 1;
}

.toolbar-input-prompt {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  cursor: auto;
}

/* Separator */

.toolbar-divider {
  background-color: #ccc;
  width: 1px;
  margin: 5px 4px;
  height: 16px;
}

.toolbar-spacer {
  flex: auto;
}

/* Long click */

.long-click-glyph {
  position: absolute;
  background-color: #5a5a5a;
  top: 0;
  left: 0;
}

.toolbar-button.emulate-active {
  background-color: rgb(163, 163, 163);
}

.toolbar-button[data-keyboard-focus='true']:focus::after {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  right: 2px;
  background-color: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  content: '';
}

.toolbar-shadow.floating {
  flex-direction: column;
  height: auto;
  background-color: white;
  border: 1px solid #ccc;
  margin-top: -1px;
  width: 28px;
  left: -2px;
}

input[is='history-input'] {
  border: 1px solid transparent;
  line-height: 16px;
  padding: 1px;
}

input[is='history-input']:hover {
  box-shadow: var(--focus-ring-inactive-shadow);
}

input[is='history-input']:focus,
input[is='history-input']:not(:placeholder-shown) {
  box-shadow: var(--focus-ring-active-shadow);
}

.toolbar-item.warning {
  background: hsl(0, 100%, 95%);
}

@media (forced-colors: active) {
  select.toolbar-item:disabled,
  select.toolbar-item:disabled + .toolbar-dropdown-arrow {
    opacity: 1;
    background-color: Graytext;
  }
  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover .toolbar-glyph,
  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus .toolbar-glyph,
  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-glyph,
  .toolbar-button:enabled:hover [is='ui-icon'].icon-mask,
  .toolbar-button:enabled:focus [is='ui-icon'].icon-mask {
    background-color: HighlightText;
  }
  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-text,
  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus:not(:active) .toolbar-text {
    color: HighlightText;
  }
  .toolbar-button:enabled.hover:not(:active) .toolbar-glyph,
  .toolbar-button.toolbar-state-on .toolbar-glyph,
  .toolbar-button:hover:enabled,
  .toolbar-button:focus,
  .toolbar-toggled-gray:not(.toolbar-render-as-links)
    .toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):hover {
    forced-color-adjust: none;
    background-color: Highlight;
  }
  .toolbar-button:disabled {
    opacity: 1;
  }
  :not(.toolbar-render-as-links) .toolbar-button:disabled .toolbar-glyph,
  .toolbar-button:disabled [is='ui-icon'].icon-mask {
    background-color: GrayText;
    color: GrayText;
  }
  .toolbar-item,
  .toolbar-text {
    color: ButtonText;
  }
  .toolbar-input {
    forced-color-adjust: none;
    background: Canvas;
    box-shadow: var(--focus-ring-inactive-shadow);
  }
  .toolbar-input.focused,
  .toolbar-input:not(.toolbar-input-empty) {
    forced-color-adjust: none;
    background: Canvas;
    box-shadow: var(--focus-ring-active-shadow);
  }
  .toolbar-input:hover {
    box-shadow: var(--focus-ring-active-shadow);
  }
  .toolbar-item .devtools-link {
    color: LinkText;
  }
}
